<script>
	export default {
		globalData:{
			userData:{},
			listData:[],
			loginUpdate:false,
			login:false
		},
		onLaunch:function() {
			const userData=uni.getStorageSync("userInfo")
			
			console.log("App onLaunch")
			if(userData){
				this.globalData.login=true
				const {openid,nickName,avatarUrl}=userData
				this.globalData.userData={openid,nickName,avatarUrl}
				// console.log(this.globalData.userData)
				// console.log(userData)
			}
		},
		onShow:async function() {
			let userdata={}
			if(this.globalData.login){
				console.log(1)
				userdata.openid=this.globalData.userData.openid
			}else{
				userdata.openid="test"
			}
			let data=await uniCloud.callFunction({
				name:"getDatas",
				data:userdata
			})
			this.globalData.listData=data.result
			console.log(this.globalData)
		},
		onHide: function() {
			console.log('App Hide')
		},
		
	}
</script>

<style>
	@import url("./static/icon/iconfont-weapp-icon.css");
	/*每个页面公共css */
</style>
